﻿#define   _CRT_SECURE_NO_WARNINGS
#include <stdio.h>  
void findTwoSingleNumbers(int* nums, int size, int* num1, int* num2) {
    int xor_result = 0;
    for (int i = 0; i < size; i++) {
        xor_result ^= nums[i];
    }
    int rightmost_set_bit = xor_result & -xor_result;
    *num1 = 0;
    *num2 = 0;

    for (int i = 0; i < size; i++) {
        if (nums[i] & rightmost_set_bit) {
            *num1 ^= nums[i];  
        }
        else {
            *num2 ^= nums[i];  
        }
    }
}

int main() {
    int nums[] = { 1, 2, 3, 4, 5, 1, 2, 3, 4, 6 };
    int num1, num2;

    findTwoSingleNumbers(nums, sizeof(nums) / sizeof(nums[0]), &num1, &num2);

    printf("The two numbers that appear only once are: %d and %d\n", num1, num2);

    return 0;
}